<%
'--------------------------------------
'Power By 方卡在线 @2010-2014 f02
'URL:http://www.fangka.net/
'EMail:admin@ifangka.com
'QQ:861118936
'版权所有 未经允许不得去除本版权信息
'--------------------------------------


'================初始化，创建字段
'Call initWapField()
Function initWapField()
	Dim FieldsName,Flag
	FieldsName = "Fk_Site_TemplateWap"
	Flag = False

	Sqlstr="Select Top 1 * From [Fk_Site]"
	Call FKDB.DB_Open()
	Rs.Open Sqlstr,Conn,1,1
	For i=0 To RS.Fields.Count-1
		If RS.Fields(i).Name=FieldsName Then
			Flag=True
		End If
	Next
	Rs.Close
	
	If Flag = False Then
		Call FKDB.DB_Open()
		Sqlstr = "ALTER TABLE [Fk_Site] ADD COLUMN ["&FieldsName&"] varchar(50)"
		Rs.Open Sqlstr,Conn,1,3
		Conn.Close
	End If
End Function

Call FKDB.DB_Open()
Sqlstr="Select * From [Fk_Site]"
Rs.Open Sqlstr,Conn,1,1
If Not Rs.Eof Then
	'常规
	Fk_Site_Name=Rs("Fk_Site_Name")
	Fk_Site_Url=Rs("Fk_Site_Url")
	Fk_Site_Keyword=Rs("Fk_Site_Keyword")
	Fk_Site_Description=Rs("Fk_Site_Description")
	Fk_Site_Open=Rs("Fk_Site_Open")
	Fk_Site_CloseStr=Rs("Fk_Site_CloseStr")
	Fk_Site_Template=Rs("Fk_Site_Template")
	Fk_Site_PageSize=Rs("Fk_Site_PageSize")
	'生成模式
	Fk_Site_Html=Rs("Fk_Site_Html")
	Fk_Site_IndexInUrl=Rs("Fk_Site_IndexInUrl")
	Fk_Site_HtmlSuffix=Rs("Fk_Site_HtmlSuffix")
	'上传格式
	Fk_Site_LinkExt=Rs("Fk_Site_LinkExt")
	Fk_Site_PicExt=Rs("Fk_Site_PicExt")
	Fk_Site_FlashExt=Rs("Fk_Site_FlashExt")
	Fk_Site_MediaExt=Rs("Fk_Site_MediaExt")
	Fk_Site_UploadSize=Clng(Rs("Fk_Site_UploadSize"))
	'调试选项
	Fk_Site_TemplateDebug=Rs("Fk_Site_TemplateDebug")
	Fk_Site_Debug=Rs("Fk_Site_Debug")
	Fk_Site_Editor=Rs("Fk_Site_Editor")
	'其他
	Fk_Site_Field=Rs("Fk_Site_Field")
	'图片水印与缩略
	Fk_Site_WaterMark=Rs("Fk_Site_WaterMark")
	Fk_Site_WaterMarkOption=Rs("Fk_Site_WaterMarkOption")
	Fk_Site_Thumb=Rs("Fk_Site_Thumb")
	Fk_Site_ThumbOption=Rs("Fk_Site_ThumbOption")
	'留言邮件功能
	Fk_Site_EMail=Rs("Fk_Site_EMail")
	Fk_Site_EMailOption=Rs("Fk_Site_EMailOption")
	'隐藏功能
	Fk_Site_HideLink=Rs("Fk_Site_HideLink")
	If Request.Cookies("h_c_f_k")="is_Close" Then
		Fk_Site_HideLink_Str=",,"
	Else
		Fk_Site_HideLink_Str=Fk_Site_HideLink
	End If

	'手机模板
	Fk_Site_TemplateWap=Rs("Fk_Site_TemplateWap")
Else
	Rs.Close
	Call FKFun.ShowErr("站点配置读取失败，请重新安装！",0)
End If
Rs.Close

If Fk_Site_IndexInUrl=1 Then
	Fk_Site_IndexInUrl="Index.asp"
Else
	Fk_Site_IndexInUrl=""
End If
If Fk_Site_Html=0 Or Fk_Site_Html=1 Then
	FullSiteDir=SiteDir&Fk_Site_IndexInUrl&"?"
	FullSiteUrl=Fk_Site_Url&Fk_Site_IndexInUrl&"?"
ElseIf Fk_Site_Html=2 Or Fk_Site_Html=3 Then
	FullSiteDir=SiteDir
	FullSiteUrl=Fk_Site_Url
End If
FullHtmlSuffix=FKFun.GetHtmlSuffix(Fk_Site_HtmlSuffix)


Fk_In_Wap = 0
'根据用户浏览器agent判断是否使用手机模板
If Fk_Site_TemplateWap<>"" Then
	Dim bagent,regex
	bagent = Request.ServerVariables("HTTP_USER_AGENT")
	set regex = new regexp
	regex.ignorecase = True
	regex.global = True
	regex.pattern = "iPhone|iPod|Android|ios"
	if regex.test(bagent) Then
		Fk_Site_Template = Fk_Site_TemplateWap
		Fk_In_Wap = 1
	End If
End If
%>
